Skip to content

Subcellular Localization Integration & Testing#36

Merged
Siddharthakhandelwal merged 3 commits into
mainfrom
subcellular
Mar 31, 2026
Merged

Subcellular Localization Integration & Testing#36
Siddharthakhandelwal merged 3 commits into
mainfrom
subcellular

Conversation

@jyotsana15

Copy link
Copy Markdown
Collaborator

Overview

This PR fully integrates the Subcellular Localization feature into the Protly application. It correctly positions the newly provided SubcellularLocation component within the frontend file hierarchy, wires it up in the main App.jsx Analysis view, and introduces comprehensive unit tests for both the frontend rendering and the backing API endpoint.

Changes Included

Frontend Updates 🎨

  • Component Relocation: Moved SubcellularLocation.jsx from the project root to frontend/src/components/ to align with the standard project hierarchy.
  • Analysis View Integration: Updated frontend/src/App.jsx to import and render the <SubcellularLocation /> component within the dashboard's right column (between ProteinBio and LabReadiness), passing the parsed localization data from the UniProt API.
  • UI Tests: Added frontend/src/tests/SubcellularLocation.test.jsx containing 10 comprehensive Vitest tests:
    • Verified skeleton loaders during the loading state.
    • Verified component hides cleanly when no localization data is present.
    • Verified location counts and dynamic singular/plural labeling.
    • Verified rendering of sub-attributes like topology, orientation, and conditional note blocks.

Backend Updates ⚙️

  • Test Environment Configuration: Introduced backend/tests/conftest.py to correctly append the parent directory to sys.path. This permanently resolves the import main visibility issue across the test suite regardless of the execution directory.
  • API Tests: Added backend/tests/test_subcellular.py containing 8 robust Pytest tests specifically targeting the /api/uniprot/entry/{accession} endpoint:
    • Tested "happy path" parsing of the SUBCELLULAR LOCATION comment blocks from the UniProt REST API.
    • Verified missing locations, empty comment blocks, and gracefully skipping malformed data.
    • Tested proper 502 Bad Gateway handling for upstream UniProt failures.

Testing Instructions

  1. Backend:
    • Navigate to backend/
    • Run pytest tests/ (16/16 tests should pass)
  2. Frontend:
    • Navigate to frontend/
    • Run npm run test (17/17 tests should pass)
  3. Manual Verification:
    • Start the stack (npm run dev and uvicorn main:app).
    • Search for a protein (e.g., P53_HUMAN or EGFR_HUMAN) and click "Analyze".
    • Verify the Subcellular Localization card renders correctly with the corresponding color-coded, emoji-decorated location badges.

Notes for Reviewer

The backend logic for parsing the UniProt SUBCELLULAR LOCATION block was already perfectly implemented in main.py. This PR solely focuses on integrating the frontend component, structuring the project professionally, and establishing a robust test net.

@jyotsana15 jyotsana15 self-assigned this Mar 30, 2026
@jyotsana15 jyotsana15 added the enhancement New feature or request label Mar 30, 2026
Comment thread backend/tests/test_subcellular.py Fixed

@Siddharthakhandelwal Siddharthakhandelwal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cute

@Siddharthakhandelwal Siddharthakhandelwal merged commit 8905fda into main Mar 31, 2026
8 checks passed
@Siddharthakhandelwal Siddharthakhandelwal deleted the subcellular branch March 31, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants